#include <asm/regdef.h>
#include <asm/asm.h>
#include <asm/m32c0.h>
#include <asm/mipsregs.h>

    .org    0x20
    .globl  boot
    .ent    boot
    .set    noreorder
boot:
    # disable interrupt to avoid reboot exception
    di

    # set kseg0 uncache
    mfc0    t0, CP0_CONFIG
    li      t1, 0x2
    ins     t0, t1, 0, 3
    mtc0    t0, CP0_CONFIG
    ehb

	# clear bss
	la		t0, _fbss
	la		t1, _end
1:
	sw		zero, 0(t0)
	bne		t0, t1, 1b
	addiu	t0, 4

	# setup gp and stack
	la		gp, _gp
	la		sp, _user_stack
	li		t0, ~0xf
	and		sp, t0

    la      t0, start
    jr      t0
    nop

    .set    reorder
    .end    boot

